package com.cty;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class regExpression10 {
    public static void main(String[] args) {
        //测试反向引用
        //要求：千位与个位相同，十位与百位相同的四位数
        String content = "juejiangdehouzi 8448 2002 3655";
        String regStr = "(\\d)(\\d)\\2\\1";//\\2代表引用第1个分组里面的内容，\\1代表引用第1个分组里面的内容
        Pattern compile = Pattern.compile(regStr);
        Matcher matcher = compile.matcher(content);
        while (matcher.find()) {
            System.out.println("提取到：" + matcher.group(0));

        }
    }
}
